{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (3912711430.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[3], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple\u001b[0m\n\u001b[1;37m        ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install tushare -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install sqlalchemy -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install mysql-connector-python -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install mysql-connector-python -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install django -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install pymysql -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "pip install mysql -i https://pypi.tuna.tsinghua.edu.cn/simple\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple\n",
      "Collecting pymysql\n",
      "  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/0c/94/e4181a1f6286f545507528c78016e00065ea913276888db2262507693ce5/PyMySQL-1.1.1-py3-none-any.whl (44 kB)\n",
      "Installing collected packages: pymysql\n",
      "Successfully installed pymysql-1.1.1\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleNote: you may need to restart the kernel to use updated packages.\n",
      "\n",
      "Collecting mysql\n",
      "  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/9a/52/8d29c58f6ae448a72fbc612955bd31accb930ca479a7ba7197f4ae4edec2/mysql-0.0.3-py3-none-any.whl (1.2 kB)\n",
      "Collecting mysqlclient (from mysql)\n",
      "  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/bb/b5/2a8a4bcba3440550f358b839638fe8ec9146fa3c9194890b4998a530c926/mysqlclient-2.2.7-cp312-cp312-win_amd64.whl (208 kB)\n",
      "     ---------------------------------------- 0.0/208.0 kB ? eta -:--:--\n",
      "     - -------------------------------------- 10.2/208.0 kB ? eta -:--:--\n",
      "     - -------------------------------------- 10.2/208.0 kB ? eta -:--:--\n",
      "     ---------- -------------------------- 61.4/208.0 kB 409.6 kB/s eta 0:00:01\n",
      "     ---------- -------------------------- 61.4/208.0 kB 409.6 kB/s eta 0:00:01\n",
      "     ---------- -------------------------- 61.4/208.0 kB 409.6 kB/s eta 0:00:01\n",
      "     --------------------- -------------- 122.9/208.0 kB 423.5 kB/s eta 0:00:01\n",
      "     -------------------------- --------- 153.6/208.0 kB 458.0 kB/s eta 0:00:01\n",
      "     ------------------------------------ 208.0/208.0 kB 575.0 kB/s eta 0:00:00\n",
      "Installing collected packages: mysqlclient, mysql\n",
      "Successfully installed mysql-0.0.3 mysqlclient-2.2.7\n"
     ]
    }
   ],
   "source": [
    "pip install mysql -i https://pypi.tuna.tsinghua.edu.cn/simple"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import tushare as ts\n",
    "import MySQLdb as mdb\n",
    "\n",
    "import matplotlib\n",
    "matplotlib.use(\"TkAgg\")\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "from matplotlib.collections import LineCollection\n",
    "\n",
    "import pandas as pd\n",
    "from sklearn import cluster,covariance,manifold\n",
    "\n",
    "from matplotlib.font_manager import FontProperties\n",
    "\n",
    "\n",
    "import tushare as ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "pro = ts.pro_api('579f438eb79d5ee41e68586e4adf0dfc11edb58d68b6843e9d843518')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 5396 entries, 0 to 5395\n",
      "Data columns (total 10 columns):\n",
      " #   Column        Non-Null Count  Dtype \n",
      "---  ------        --------------  ----- \n",
      " 0   ts_code       5396 non-null   object\n",
      " 1   symbol        5396 non-null   object\n",
      " 2   name          5396 non-null   object\n",
      " 3   area          5380 non-null   object\n",
      " 4   industry      5380 non-null   object\n",
      " 5   cnspell       5396 non-null   object\n",
      " 6   market        5396 non-null   object\n",
      " 7   list_date     5396 non-null   object\n",
      " 8   act_name      2575 non-null   object\n",
      " 9   act_ent_type  2575 non-null   object\n",
      "dtypes: object(10)\n",
      "memory usage: 421.7+ KB\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "ts_code         5396\n",
       "symbol          5396\n",
       "name            5396\n",
       "area            5380\n",
       "industry        5380\n",
       "cnspell         5396\n",
       "market          5396\n",
       "list_date       5396\n",
       "act_name        2575\n",
       "act_ent_type    2575\n",
       "dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pro.query('stock_basic', exchange='',list_status='L')\n",
    "data.info()\n",
    "data.count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5396"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sqlalchemy import create_engine\n",
    "\n",
    "engine = create_engine('mysql+pymysql://root:zhyzhy666@localhost/stock_basic')\n",
    "\n",
    "data.to_sql('stock_basic', con=engine, if_exists='replace', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 000001.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000001.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2 000002.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000002.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3 000004.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000004.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4 000006.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000006.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5 000007.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000007.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6 000008.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000008.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7 000009.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000009.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8 000010.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000010.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9 000011.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000011.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10 000012.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000012.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11 000014.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000014.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "12 000016.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000016.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "13 000017.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000017.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "14 000019.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000019.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "15 000020.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000020.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "16 000021.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000021.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "17 000025.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000025.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "18 000026.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000026.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "19 000027.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000027.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "20 000028.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000028.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "21 000029.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000029.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "22 000030.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000030.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "23 000031.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000031.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "24 000032.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000032.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "25 000034.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000034.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "26 000035.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000035.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "27 000036.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000036.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "28 000037.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000037.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "29 000039.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000039.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30 000040.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000040.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "31 000042.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000042.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "32 000045.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000045.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "33 000048.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000048.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "34 000049.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000049.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "35 000050.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000050.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "36 000055.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000055.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "37 000056.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000056.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "38 000058.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000058.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "39 000059.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000059.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "40 000060.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000060.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "41 000061.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000061.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "42 000062.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000062.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "43 000063.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000063.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "44 000065.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000065.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "45 000066.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000066.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "46 000068.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000068.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "47 000069.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000069.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "48 000070.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000070.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "49 000078.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000078.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "50 000088.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000088.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "51 000089.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000089.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "52 000090.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000090.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "53 000096.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000096.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "54 000099.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000099.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "55 000100.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000100.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "56 000151.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000151.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "57 000153.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000153.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "58 000155.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000155.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "59 000156.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000156.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "60 000157.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000157.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "61 000158.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000158.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "62 000159.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000159.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "63 000166.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000166.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "64 000301.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000301.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "65 000333.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000333.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "66 000338.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000338.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "67 000400.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000400.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "68 000401.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000401.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "69 000402.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000402.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "70 000403.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000403.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "71 000404.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000404.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "72 000407.SZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Renaissance\\AppData\\Local\\Temp\\ipykernel_1928\\2484983286.py:12: UserWarning: The provided table name '000407.SZ' is not found exactly as such in the database after writing the table, possibly due to case sensitivity issues. Consider using lower case table names.\n",
      "  data_price.to_sql(stock, con=engine, if_exists='append', index=False)\n"
     ]
    }
   ],
   "source": [
    "stock_list = data['ts_code'].tolist()\n",
    "\n",
    "data_price=[]\n",
    "\n",
    "i=0\n",
    "for stock in data['ts_code'].tolist():\n",
    "            if i==72:\n",
    "                    break\n",
    "            i+=1\n",
    "            print(i,stock)\n",
    "            data_price=pro.daily(ts_code=stock)\n",
    "            data_price.to_sql(stock, con=engine, if_exists='append', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   count(*)\n",
      "0      5396\n",
      "     ts_code  symbol  name area industry cnspell market list_date act_name  \\\n",
      "0  000008.SZ  000008  神州高铁   北京     运输设备    szgt     主板  19920507     None   \n",
      "\n",
      "  act_ent_type  \n",
      "0         None  \n"
     ]
    }
   ],
   "source": [
    "sql = \"select count(*) from stock_basic.stock_basic\"\n",
    "df = pd.read_sql(sql, engine)\n",
    "print(df)\n",
    "\n",
    "sql = \"select * from stock_basic.stock_basic where name='神州高铁'\"\n",
    "df = pd.read_sql(sql, engine)\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "        ts_code trade_date  open  high   low  close  pre_close  change  \\\n",
      "0     000017.SZ   20250127  5.56  5.67  5.53   5.57       5.54    0.03   \n",
      "1     000017.SZ   20250124  5.54  5.57  5.41   5.54       5.50    0.04   \n",
      "2     000017.SZ   20250123  5.57  5.65  5.50   5.50       5.51   -0.01   \n",
      "3     000017.SZ   20250122  5.65  5.65  5.49   5.51       5.62   -0.11   \n",
      "4     000017.SZ   20250121  5.77  5.79  5.54   5.62       5.76   -0.14   \n",
      "...         ...        ...   ...   ...   ...    ...        ...     ...   \n",
      "5995  000017.SZ   19950918  4.01  4.03  4.00   4.01       4.01    0.00   \n",
      "5996  000017.SZ   19950915  3.98  4.05  3.98   4.01       4.01    0.00   \n",
      "5997  000017.SZ   19950914  4.00  4.05  3.99   4.01       3.99    0.02   \n",
      "5998  000017.SZ   19950913  3.99  4.00  3.97   3.99       3.99    0.00   \n",
      "5999  000017.SZ   19950912  4.02  4.12  3.98   3.99       3.99    0.00   \n",
      "\n",
      "      pct_chg        vol     amount  \n",
      "0      0.5415  114865.00  64418.383  \n",
      "1      0.7273  116098.00  64018.002  \n",
      "2     -0.1815  103224.03  57591.413  \n",
      "3     -1.9573   86885.72  47948.744  \n",
      "4     -2.4306  125370.54  70427.681  \n",
      "...       ...        ...        ...  \n",
      "5995   0.0000    1449.00    580.675  \n",
      "5996   0.0000    1867.00    748.442  \n",
      "5997   0.5000    2506.00   1008.631  \n",
      "5998   0.0000    1718.00    685.649  \n",
      "5999   0.0000    3854.00   1545.882  \n",
      "\n",
      "[6000 rows x 11 columns]\n"
     ]
    }
   ],
   "source": [
    "sql = \"select * from stock_basic.`000017.sz`\"\n",
    "df = pd.read_sql(sql, engine)\n",
    "print(df)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
